import React, { Component } from 'react'
import { connect } from 'react-redux'//inject
import  {addNum} from "../action/numAction"

 class A3 extends Component<any,any> {
  render() {
    return (
      <div>A3
          <h1>使用的全局数据为{this.props.num}</h1>
          <button onClick={()=>{
              this.props.addNum(10);
          }}>修改全局数据</button>
      </div>
    )
  }
}

const mapStateToProps = (state:any) => ({
    num:state.numInfo.num
})

const mapDispatchToProps = {
    addNum
}

export default connect(mapStateToProps, mapDispatchToProps)(A3)